Jardim et al. (2023): Supplementary Materials

This document contains all data analyses presented in the main article as well as supplementary materials.

The analysis was organized using the make-line pipeline tool provided by targets (Landau 2021). You will find raw data as well as all functions used in the pipeline in the project’s research compendium created with the rcompendium package (Casajus N. 2022).

You can take a look at the pipeline in order to understand some steps (mostly related to tidying data)

 

 

Packages

Code
library(dplyr)
library(tidyr)
library(vegan)
library(ggplot2)
library(targets)
library(ggrepel)
theme_set(theme_light())

Habitat Complexity

Take a look at the structure of the final complexity dataset

Code
tar_load(comp)
knitr::kable(head(comp))

 

First lines of the complexity dataset
Mini Site Point Sample Branching_density Broken_density D_bin D_gray L I S Total_Density Dry_weight Sphericity DR1 DR2 DR3
MBE_1 Belle-ile Belle-ile 1 1 5.8 0.0 1.1231 2.6562 12.85333 9.143333 8.303333 181696 183.61 0.8371338 0.6460062 0.8153846 0.7113589
MBE_1 Belle-ile Belle-ile 1 2 1.0 0.0 1.0654 2.6463 16.07667 7.883333 5.393333 181696 183.61 0.6122605 0.3354758 0.7669267 0.4903587
MBE_1 Belle-ile Belle-ile 1 3 3.0 0.2 1.0722 2.6450 15.30000 8.103333 7.190000 181696 183.61 0.7470808 0.4699346 0.8873818 0.5296296
MBE_1 Belle-ile Belle-ile 1 4 4.8 0.4 1.1078 2.6492 12.91667 8.476667 6.203333 181696 183.61 0.7057078 0.4802581 0.6613704 0.6562581
MBE_1 Belle-ile Belle-ile 1 5 4.2 0.0 1.1305 2.7019 24.54667 14.523333 8.970000 181696 183.61 0.6088477 0.3654264 0.6434838 0.5916621
MBE_1 Belle-ile Belle-ile 1 6 3.0 0.4 1.1198 2.6641 16.35667 9.416667 6.783333 181696 183.61 0.6684949 0.4147137 0.7249304 0.5757082

 

Most variables are not normally distributed so we apply a box-cox (Box and Cox 1964) transformation and check correlations between the transformed variables

Code
tar_read(pairscomp)

Figure S 1: ?(caption)

PCA of all observations

Let’s check it without removing highly correlated variables

Code
tar_load(pcatotal)
tar_read(sptot)

Figure S 2: Screeplot of the PCA including all observations and all variables

We had up to 6 relevant axes to look at, but we know we have several highly correlated variables

Code
tar_load(pcatot)
plot(pcatot)

Figure S 3: PCA of all observations

Code
tar_load(pcatotsel)
tar_read(sptotsel)

Figure S 4: Screeplot of the PCA including all observations and selected variables

Let’s check the biplots of the selected variables

Code
tar_load(pcasel)
plot(pcasel)

Figure S 5: PCA of all observations after variable selection

PCA of median values

Code
tar_read(spmedsel)

Figure S 6: Screeplot of the PCA of median values at the point level

Let’s check the biplots of the selected variables

Figure 1

Code
tar_load(pcamed)
plot(pcamed)

Figure 1 (main article)

Check correlation between the centroids of the total PCA and the scores of the reduced PCA

Code
tar_load(corcomp)
plot(corcomp[[1]])
`geom_smooth()` using formula = 'y ~ x'
Code
plot(corcomp[[2]])
`geom_smooth()` using formula = 'y ~ x'
Code
tar_read(cortestcomp1)
tar_read(cortestcomp2)

    Pearson's product-moment correlation

data:  med_sel2$PC1_c and med_sel2$PC1_score
t = -12.623, df = 28, p-value = 4.471e-13
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.9626648 -0.8416107
sample estimates:
       cor 
-0.9222483 

    Pearson's product-moment correlation

data:  med_sel2$PC2_c and med_sel2$PC2_score
t = -14.294, df = 28, p-value = 2.165e-14
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.9702598 -0.8722282
sample estimates:
       cor 
-0.9378045 

(a) PC1

(b) PC2

Figure S 7: Relation between Full PCA centroids and Reduced PCA scores

Fauna

Code
tar_load(faunadata)
knitr::kable(head(faunadata))

 

First lines of the original macrofaunal data
Point Site Replicate Method Habitat Year Season Date Species Abundance
Belle-ile 1 Belle-ile 1 Grab Maerl 2007 Spring 2007-03-11 00:00:00 Abludomelita gladiosa 1
Belle-ile 1 Belle-ile 1 Grab Maerl 2007 Spring 2007-03-11 00:00:00 Abra alba 1
Belle-ile 1 Belle-ile 1 Grab Maerl 2007 Spring 2007-03-11 00:00:00 Ampharete spp. 1
Belle-ile 1 Belle-ile 1 Grab Maerl 2007 Spring 2007-03-11 00:00:00 Amphipholis squamata 2
Belle-ile 1 Belle-ile 1 Grab Maerl 2007 Spring 2007-03-11 00:00:00 Anapagurus hyndmanni 1
Belle-ile 1 Belle-ile 1 Grab Maerl 2007 Spring 2007-03-11 00:00:00 Aonides oxycephala 3

 

Data availability

Code
samplespoint <- faunadata %>% 
  mutate(Date=as.factor(format.Date(faunadata$Date,"%Y"))) %>% 
  distinct(Site, Year, Point, Replicate) %>%
  group_by(Site, Year, Point) %>%
  mutate(Year = as.factor(Year)) %>% 
  summarise(count = n()) %>%
  ungroup() %>%
  mutate(State = factor(case_when(count==3 ~ "Good", count < 3 ~ "Sample(s) missing", count > 3 ~ "Too many samples")))

ggplot(samplespoint, aes(x=Year,y=Point,fill=State)) +
  geom_tile(alpha=0.5) +
  scale_fill_manual(values=c("palegreen3","lightblue", "indianred")) +
  geom_text(aes(label=count)) +
  theme(text=element_text(size =15), axis.text.x = element_text(angle = 90, size = 15), legend.position = "bottom")

Figure S 8: Number of grab samples taken every year at each point

Empty cells show points where no samples were collected at a given date due to field constraints.

Alpha diversity

Total richness

Code
# Total richness
tar_load(faunaclass)
total_rich <- nrow(faunaclass %>% 
  distinct(., Species)) #725 species

# Total richness by sediment position

epi_rich <- nrow(faunaclass %>% 
  filter(Position == "Epifauna") %>% 
  distinct(., Species)) #341 epifaunal species


inf_rich <- nrow(faunaclass %>% 
  filter(Position == "Infauna") %>% 
  distinct(., Species)) #266  infaunal species


int_rich <- nrow(faunaclass %>% 
  filter(Position == "Interstice") %>% 
  distinct(., Species)) #118 interstitial species

There are 725 species in total, 341 being epifaunal, 266 being infaunal, and 118 interstitial.

Relative abundance

Figure S2

Code
tar_read(relab_phy)
tar_read(relab_ord) 

(a) Main Phylla

(b) Main Orders

Figure S 9: Average Relative Abundance of Main Phyla and Orders

p.s.: it is normal to have NAs for some orders as higher classification for some of the species is ambiguous or unknown.

Code
tar_read(relab_arth)
tar_read(relab_ann) 
tar_read(relab_mol)

(a) Arthropoda

(b) Annelida

 

(c) Mollusca

 

Figure S 10: Families Average Relative Abundance for Each Main Phyla

References

Box, G. E. P., and D. R. Cox. 1964. “An Analysis of Transformations.” Journal of the Royal Statistical Society. Series B (Methodological) 26 (2): 211–52. https://www.jstor.org/stable/2984418.
Casajus N. 2022. Rcompendium: An r Package to Create a Package or Research Compendium Structure. https://github.com/FRBCesab/rcompendium.
Landau, William Michael. 2021. “The Targets r Package: A Dynamic Make-Like Function-Oriented Pipeline Toolkit for Reproducibility and High-Performance Computing.” Journal of Open Source Software 6 (57): 2959. https://doi.org/10.21105/joss.02959.